home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SPADV.ZIP / MISC.PAS < prev    next >
Pascal/Delphi Source File  |  1980-01-01  |  2KB  |  93 lines

  1. unit Misc;
  2.  
  3. interface
  4.  
  5. uses Crt,Graph,Globals;
  6.  
  7. function Exist(FileName:string):boolean;
  8. function Lowest (a,b:integer):integer;
  9. function DeCode (Txt:string) :string;
  10. procedure TextSize (mx,dx,my,dy:word);
  11. function St(num:integer):str80;
  12. procedure Sound (Frq : integer);
  13. procedure Delay (Ms : integer);
  14. procedure Black (x,y,x1,y1:word);
  15. procedure FindFile (FilName :string);
  16.  
  17. implementation
  18.  
  19. function Exist(FileName:string):boolean;
  20. var
  21.   fil:file;
  22. begin
  23.   Assign (Fil,FileName); {$I-}
  24.   Reset (Fil);           {$I+}
  25.   if IOresult<>0 then Exist := False
  26.   else begin
  27.     Close (Fil);
  28.     Exist:=(IOResult=0);
  29.   end;
  30. end;
  31.  
  32. function Lowest (a,b:integer):integer;
  33. begin
  34.   if a<b then Lowest:=a else Lowest:=b;
  35. end;
  36.  
  37. function DeCode (Txt:string) : string;
  38. var Ctr:byte;
  39. begin
  40.   for Ctr:=1 to Length(Txt) do
  41.     Dec (Txt[Ctr], 128);
  42.   DeCode := Txt;
  43. end;
  44.  
  45. procedure TextSize (mx,dx,my,dy:word);
  46. begin
  47.   SetUserCharSize (mx,dx,my,dy);
  48.   SetTextStyle (SmallFont,HorizDir,UserCharSize);
  49. end;
  50.  
  51. function St(num:integer):str80;
  52. var strg:str80;
  53. begin
  54.   Str(num,strg);
  55.   St:=strg;
  56. end;
  57.  
  58. (*procedure Sound1 (Frq : integer);
  59. begin
  60.   Sound (Frq);
  61. end;*)
  62. procedure Sound (Frq : integer);
  63. begin
  64.   if Noise then Crt.Sound (Frq);
  65. end;
  66.  
  67. (*procedure Delay1 (Ms : integer);
  68. begin
  69.   Delay (Ms);
  70. end;*)
  71. procedure Delay (Ms : integer);
  72. begin
  73.   Crt.Delay (Ms * ((Pause div 10)+1));
  74. end;
  75.  
  76. procedure Black (x,y,x1,y1:word);
  77. begin
  78.   SetViewPort (x,y,x1,y1,ClipOn);
  79.   ClearViewPort;
  80.   SetViewPort (0,0,319,199,ClipOn);
  81. end;
  82.  
  83. procedure FindFile (FilName : string);
  84. begin
  85.   if not Exist (FilName) then begin
  86.     TextMode (Co80);
  87.     Writeln ('SPACE ADVENTURE error :');
  88.     Writeln ('The file ',FilName,' is missing !');
  89.     Halt;
  90.   end;
  91. end;
  92.  
  93. end.